home *** CD-ROM | disk | FTP | other *** search
Java Source | 2002-11-09 | 2.3 KB | 94 lines |
- //
- // The contents of this file are subject to the BadBlue End User License
- // Agreement (the "EULA"); you may not use this file except in
- // compliance with the EULA. You may obtain a copy of the EULA at
- // http://badblue.com/down.htm .
- //
- // Software distributed under the EULA is distributed on an "AS IS" basis,
- // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the EULA
- // for the specific language governing rights and limitations under the
- // EULA.
- //
- // The Initial Developer of this code under the EULA is Working Resources,
- // Inc., Atlanta, GA UNITED STATES. All Rights Reserved.
- //
-
- //
- package ShareOffice;
-
- //
- import java.net.*;
- import java.io.*;
- import ShareOffice.HTTPGet;
- import ShareOffice.SOinit;
-
- //
- public class SOword extends SOinit {
- //
- public SOword() {
- }
- // Retrieve Word file in HTML format.
- // Inputs:
- // sAddr: address of BadBlue server (e.g., "127.0.0.1:8080")
- // sPath: path of shared file in EXT.INI file (e.g., "path3")
- // sFile: name of Excel file to examine (e.g., "invoice.xls")
- // sUser: (optional) user-name to get access to file
- // sPassword: (optional) password to get access to file
- // Outputs:
- // sDoc: string variable consisting of HTML document or
- // error message in plain-text
- //
- public String GetWordDocument(
- String sAddr,
- String sPath,
- String sFile,
- String sUser,
- String sPassword
- ) {
- String sDoc;
- String sError = "";
- try {
-
- // General setup.
- //
- sDoc = new String();
-
- // Construct the URL and read it.
- //
- String sURL =
- "http://"+sAddr+"/ext.dll?MfcISAPICommand=LoadPage&"+
- "page=doc.htx&a0=/get/"+sPath+"/"+URLEncoder.encode(sFile, "UTF-8")+
- "&a1=_&a2=2048&a3=8&a4=1";
-
- System.out.println("\r\n"+sURL+"\r\n");
-
- HTTPGet h = new HTTPGet();
- // sUser = "";
- if (sUser.length() > 0) {
- sDoc = h.Read(sURL, sUser, sPassword);
- } else {
- sDoc = h.Read(sURL);
- }
- return (sDoc);
-
- // ...end SP.
- //
- } catch (StringIndexOutOfBoundsException e) {
- sDoc = "Error: string out of bounds: " + e.getMessage();
- return (sDoc);
-
- // ...end SP.
- //
- } catch (Exception e) {
- sDoc = "Error: no data available: " + e.getMessage();
- return (sDoc);
- }
- }
-
- // Private members.
- //
- }
-
- // <EOF>
- //
-